/* ---------------------------------------------------------------------------------------------
 *
 *            Capital Alliance Software Confidential Proprietary
 *            (c) Copyright CAS 201{x}, All Rights Reserved
 *                          www.pekall.com
 *
 * ----------------------------------------------------------------------------------------------
 */
package com.elvis.music.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageButton;
import android.widget.TextView;

import com.elvis.music.R;
import com.elvis.music.util.Util;

public class TypeViewAdapter extends BaseAdapter{
    
    private Context mContext;
    
    public TypeViewAdapter(Context context){
        mContext = context;
    }

    public int getCount() {
        return Util.type_image_array.length;
    }

    public Object getItem(int position) {
        return null;
    }

    public long getItemId(int position) {
        return 0;
    }

    private ImageButton mImageButton;
    
    private TextView mTextView;
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.type_view_item, null);
        }
        mImageButton = (ImageButton) convertView.findViewById(R.id.menuBtnItemImage);
        mTextView = (TextView) convertView.findViewById(R.id.menuBtnItemContent);
        mImageButton.setImageResource(Util.type_image_array[position]);
        mTextView.setText(mContext.getResources().getStringArray(R.array.type_name_array)[position]);
        mImageButton.setFocusable(false);
        mImageButton.setClickable(false);
        mImageButton.setFocusableInTouchMode(false);
        return convertView;
    }

}
